package com.time.workshop.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.widget.ScrollView;

/**
 * Created by lingcheng on 2014/5/9. 左右滑动事件冲突
 */
public class GestureScrollView extends ScrollView {
	public GestureDetector getGestureDetector() {
		return mGestureDetector;
	}

	public void setGestureDetector(GestureDetector mGestureDetector) {
		this.mGestureDetector = mGestureDetector;
	}

	private GestureDetector mGestureDetector;

	public GestureScrollView(Context context) {
		super(context);
	}

	public GestureScrollView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public GestureScrollView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent ev) {
		if (mGestureDetector != null)
			mGestureDetector.onTouchEvent(ev);
		return super.dispatchTouchEvent(ev);
	}
}
